package com.medata.service.impl;

import com.medata.dataObject.LogSearch;
import com.medata.repository.LogSearchRepository;
import com.medata.service.LogSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.sql.Timestamp;

/**
 * @author ：zb
 * @date ：Created in 2019/7/5 0005 9:06
 * @description：
 */
@Service
public class LogSearchServiceImpl implements LogSearchService {
    @Autowired
    private LogSearchRepository repository;

    @Override
    public Page<LogSearch> findByLogTimeBetweenAndActionId(Timestamp startTime, Timestamp endTime, Integer actionid, Pageable pageable) {
        return repository.findByLogTimeBetweenAndActionId(startTime,endTime,actionid,pageable);
    }

    @Override
    @Transactional
    public void deleteByLogTimeBetweenAndActionId(Timestamp startTime, Timestamp endTime, Integer actionid) {
        repository.deleteByLogTimeBetweenAndActionId(startTime,endTime,actionid);

    }

    @Override
    public void save(LogSearch logSearch) {
        repository.save(logSearch);
    }
}
